package mtn.bowen.yan.server.enums;

/**
 * @author <a href=mailto:yanbowen90@foxmail.com> bowen.yan </a>
 * @version 1.0
 * @description: kind of Dishes
 * @date 2021-10-24 9:03 AM
 */
public enum DishesKindEnum {

    /*** 主食 */
    STAPLE_FOOD(1, "主食"),
    /*** 副食 */
    NON_STAPLE_FOOD(2, "副食"),
    /*** 大荤 */
    BIG_MEAT(3, "大荤"),
    /*** 半荤 */
    HALF_MEAT(4, "半荤"),
    /*** 小荤 */
    SMALL_MEAT(5, "小荤"),
    /*** 全素 */
    VEGAN(6, "全素"),
    /*** 汤粥 */
    SOUP_PORRIDGE(7, "汤粥"),
    /*** 水果 */
    FRUIT(8, "水果"),
    /*** 未知分类 */
    UNKNOWN(99, "未知分类"),
    ;

    DishesKindEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static DishesKindEnum getDishesKind(String msg) {
        for (DishesKindEnum value : values()) {
            if (value.getMsg().equals(msg)) {
                return value;
            }
        }
        return UNKNOWN;
    }

    public static DishesKindEnum getDishesKind(Integer code) {
        for (DishesKindEnum value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return UNKNOWN;
    }

    private Integer code;
    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
